package com.project.controller;

import com.project.service.HomeService;
import com.project.service.TakewayRiderService;
import com.project.service.TravelService;
import com.project.utils.ErrorMessage;
import com.project.vo.HomeMessage;
import com.project.vo.TakewayRiderMessage;
import com.project.vo.TripAccessVO;
import org.bouncycastle.asn1.ocsp.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/risk")
public class RiskControllerApi {

    @Autowired
    HomeService homeService;

    @Autowired
    TravelService travelService;

    @Autowired
    TakewayRiderService takewayRiderService;

    @RequestMapping("/home")
    public ResponseData isPermitHome(@RequestBody HomeMessage homeMessage){

        homeService.homeRiskAssess(homeMessage);

        return null;
    }
    @RequestMapping("/travel")
    public ResponseData isPermitHome(@RequestBody TripAccessVO tripAccessVO){
        List<ErrorMessage> errorMessages = travelService.travelRiskControll(tripAccessVO);
        System.out.println(tripAccessVO.getWeight());
        return null;
    }
    @RequestMapping("/takewayRider")
    public ResponseData isPermitHome(@RequestBody TakewayRiderMessage takewayRiderMessage){
        takewayRiderService.takewayRiderRiskAssess(takewayRiderMessage);
        System.out.println(takewayRiderMessage);
        return null;
    }


}
